package com.wxx.main;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.concurrent.TimeUnit;

public class MainThread {

	@SuppressWarnings("unused")
	public static void main(String[] args) throws IOException, InterruptedException {
		String[] ar = new String[5];
		
		String[] arr = { "a", "b", "c" };
		for (String str : arr) {
			try {
				TimeUnit.SECONDS.sleep(4);
				System.out.println(">>>>>>>>>" + str);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
		String cmd ="chmod a+x test.sh";
		Process proc = Runtime.getRuntime().exec(cmd);
		proc.waitFor();
		cmd = "bash test.sh";
		proc=Runtime.getRuntime().exec(cmd);
		String ls_1;
		
		BufferedReader bf = new BufferedReader(new InputStreamReader(proc.getInputStream()));
		while((ls_1=bf.readLine())!=null);
		bf.close();
		proc.waitFor();
	}

}